home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 042a / 3dlib17f.zip / HDR3D.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-15  |  3KB  |  88 lines

  1. (******************************************************************************
  2. *                                    hdr3d                                    *
  3. * This unit includes the headers needed for 3D manipulation ..                *
  4. ******************************************************************************)
  5. unit hdr3d;
  6.  
  7. interface
  8.  
  9. const
  10.     MaxPoints  = 20;
  11.     MaxLines   = 50;
  12.     maxObjects = 9; {size of object table}
  13.     maxNest    = 10; {size of loop table of interpreter}
  14.  
  15. const ScreenWidth = 1000;
  16.       HalfWidth   = screenWidth / 2;
  17.  
  18.       radFactor = 180 / 3.1415926535897932385;
  19.  
  20. type
  21.     Line3d  = record
  22.        FromP, ToP  : integer;
  23.     end;
  24.     screenPoints = record
  25.        sX,sY : integer;
  26.     end;
  27.     axisType = (x,y,z);
  28.  
  29. type
  30.     point3d = record
  31.        x, y, z     : real;
  32.     end;
  33.  
  34. const
  35.        zeroPoint : point3d = (x:0.0; y:0.0; z:0.0);
  36.        xAxis : integer = 45;
  37.        yAxis : integer = 45;
  38.  
  39. var
  40. {$ifdef windows}
  41.        MaxX, MaxY : word;          { In pixels for graphics screen }
  42.        MaxColor   : word;
  43. {$endif}
  44.        cosine_x,cosine_y,sine_x,sine_y : Real;
  45.        currentPath : string[32];
  46. const
  47.        currentAxis : axisType = x;
  48.  
  49.  
  50. Procedure CalcAxisDeg;
  51. procedure setDefaultSuffix(var Fname : string; suffix : string);
  52.  
  53. implementation
  54.  
  55. (******************************************************************************
  56. *                                 CalcAxisDeg                                 *
  57. * calculate sines and cosines of axis, xAxis + yAxis = 90 !                   *
  58. ******************************************************************************)
  59. Procedure CalcAxisDeg;
  60. begin
  61.      Cosine_X := cos(Xaxis/RadFactor);
  62.      Cosine_Y := cos(Yaxis/RadFactor);
  63.      Sine_X   := sin(Xaxis/RadFactor);
  64.      Sine_Y   := sin(Yaxis/RadFactor);
  65. end; {calcAxisDeg}
  66.  
  67. (*******************************************************************************
  68. *                              setDefaultSuffix                                *
  69. *   Set the suffix if Fname to .suffix, if it does not have a suffix           *
  70. *******************************************************************************)
  71. procedure setDefaultSuffix;
  72. var
  73.     i  : integer;
  74. begin
  75.     i := length(Fname);
  76.     while (i > 0) and (Fname[i] <> '.') do
  77.        dec(i);
  78.     if (i = 0) then
  79.        Fname := Fname + '.' + suffix;
  80. end; {setDefaultSuffix}
  81.  
  82. (******************************************************************************
  83. *                                    end.                                     *
  84. ******************************************************************************)
  85. begin
  86.        calcAxisDeg;
  87. end.
  88.